﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HtmlAgilityPack;

namespace FrameworkQ.Readable
{
    /// <summary>
    /// Parses html content and makes it readable ...
    /// </summary>
    public class Parser
    {
        public Parser()
        {
        }

        private string _title = string.Empty;
        public string Title
        {
            get { return _title; }
            internal set { _title = value; }
        }


        private string _text = string.Empty;
        public string Text 
        {
            get { return _text; }
            internal set { _text = value; }
        }

        private string _html = string.Empty;
        public string Html
        {
            get { return _html; }
            internal set { _html = value; }
        }

        public ITextParserStrategy Strategy { get; set; }

        public bool Parse(string htmlString)
        {
            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(html: htmlString);

            return this.Strategy.Parse(document: doc, parser: this);
        }
    }
}
